home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9325 < prev    next >
Encoding:
Text File  |  1996-08-05  |  703 b   |  37 lines

  1. Newsgroups: comp.lang.c
  2. Path: surfnet.nl!sun4nl!nikhefk!bouvere
  3. From: bouvere@paramount.nikhefk.nikhef.nl (Ferdinand de Bouvere)
  4. Subject: What is the correct behaviour ?
  5. Message-ID: <1996Mar9.130223.1400@paramount.nikhefk.nikhef.nl>
  6. Organization: NIKHEFK
  7. Date: Sat, 9 Mar 1996 13:02:23 GMT
  8.  
  9. Trying this code on 3 platforms:
  10.  
  11.     int a = 0;
  12.  
  13.     main()
  14.     {
  15.         int a = 123;
  16.         {
  17.             extern int a;
  18.             printf("%d\n", a);
  19.         }
  20.     }
  21.  
  22. HP/UX compiler: OK
  23. result: 0
  24.  
  25. Linux gcc: OK
  26. result: 123
  27.  
  28. SUN compiler (pre ansi): compile error:
  29.     "c.c", line 7: redeclaration of a
  30.     Compilation failed
  31.  
  32. So, what should be the correct behaviour ?
  33.  
  34. Ferdi,
  35. <bouvere@nikhefk.nikhef.nl>
  36.  
  37.